using System.Windows;
using System.Windows.Controls;
using NUnit.Framework;
using WPFUtilities;

namespace WPFUtilitiesUnitTests
{
    [TestFixture]
    public class VisualTreeElementFinderTests
    {
        [Test]
        public void FindByName()
        {
            DockPanel root = new DockPanel();
            root.Name = "root";
            Button childOne = new Button();
            childOne.Name = "childOne";
            root.Children.Add(childOne);
            DependencyObject result = VisualTreeElementFinder.Find(root, childOne.Name);
            Assert.AreSame(childOne, result);
        }
    }
}
